<template>
  <div class="container">
    <Aside></Aside>
    <div class="main-box">
      <Header></Header>    
      <el-form
        :model="user"
        label-width="80px"
        label-position="right"
        size="medium"
        style="width: 300px"
      >
        <el-form-item label="用户类型">
          <el-input :disabled="true" v-model="user.roleName"></el-input>
        </el-form-item>
        <el-form-item label="用户昵称">
          <el-input v-model="user.nickName"></el-input>
        </el-form-item>
        <el-form-item label="用户账号">
          <el-input v-model="user.account"></el-input>
        </el-form-item>
        <el-form-item label="新密码">
          <el-input
            type="password"
            v-model="user.password"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item label="确认密码">
          <el-input
            type="password"
            v-model="user.checkword"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="submitForm" size="small"
            >提交</el-button
          >
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
import Aside from "../components/aside.vue";
import Header from "../components/header.vue";
export default {
  name: "User",
  data() {
    return {
      user: {
        roleName: "超级管理员",
        nickName: "admin管理员",
        account: "admin",
        password: "",
        checkword: "",
      },
			
    };
  },
  mounted() {
    const user = {
      roleName: localStorage.getItem("rolename"),
      nickName: localStorage.getItem("nickname"),
      account: localStorage.getItem("username"),
    };
    this.user = user;
  },
  methods: {
    submitForm() {
      const user = this.user;
      if (user.password !== user.checkword) {
        this.$message.error("2次输入的密码不一致");
        return;
      }
      this.$message.success("修改成功");
    }
  },
  components: {
    Aside,
    Header,
  },
};
</script>

<style>
 
</style>
